package com.base.hong.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter


/**
 * @ClassName ViewPage2Adapter
 * @Author Hong
 * @Date 2022/2/22 18:23
 * @Version 1.0
 */
class ViewPage2Adapter : FragmentStateAdapter {
    private var data: List<Fragment>

    constructor(
        data: List<Fragment>,
        fragmentActivity: FragmentActivity
    ) : super(fragmentActivity) {
        this.data = data
    }


    constructor(data: List<Fragment>, fragment: Fragment) : super(fragment) {
        this.data = data
    }

    override fun getItemCount(): Int {
        return data.size
    }

    override fun createFragment(position: Int): Fragment {
        return data[position]
    }


}